<template>
  <div id="app" style="height: auto;display: flex;flex-direction: column;min-height: 100vh;">
    <el-container style="height: 100%;">
      <!--      顶部调整-->
      <el-header style="background-color: rgb(43, 49, 56);color: white;font-size: 20px;text-align: center;">
        <span style="font-size: 30px;margin-left: 140px">CJFX-混合式采集子系统</span>
        <el-button type="text" @click="open" icon="el-icon-switch-button"
          style="float: right;margin-top: 10px;color: white">安全退出</el-button>
        <el-button type="text" icon="el-icon-s-custom"
          style="float: right;margin-top: 7px;margin-right: 10px;color: white">
          <span style="font-weight: bolder;color: white;font-size: 18px">admin</span>
        </el-button>

      </el-header>
      <el-container>
        <el-aside width="180px" class="el-aside">
          <!--侧边栏调整-->
          <el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose"
            background-color= rgb(84,92,100) text-color="#fff" active-text-color="#ffd04b" style="height: 100%;" router>
            <el-submenu index="1">
              <template slot="title">
                <i class="el-icon-collection"></i>
                <span>数据采集</span>
              </template>
              
              <el-menu-item @click="toPage('/HomeView/DomainName')" >通用式域名采集</el-menu-item>
              <el-menu-item @click="toPage('/HomeView/KeywordSearch')" >关键词结果采集</el-menu-item>
              <el-menu-item @click="toPage('/HomeView/SupplierWeb')" v-if="false">供应商网站采集</el-menu-item>
              <el-menu-item @click="toPage('/HomeView/ThesisDatabase')">论文数据库采集</el-menu-item>
              <el-menu-item @click="toPage('/HomeView/UserDefined')" >自定义网站采集</el-menu-item>
            </el-submenu>
            <el-submenu index="3">
              <template slot="title">
                <i class="el-icon-data-analysis"></i>
                <span>内容检索</span>
              </template>
              <el-menu-item index="/HomeView/ContentRetrieval/TextRetrieval">文本检索</el-menu-item>
              <el-menu-item index="/HomeView/ContentRetrieval/ImageRetrieval">图像检索</el-menu-item>
            </el-submenu>
            <el-submenu index="2">
              <template slot="title">
                <i class="el-icon-monitor"></i>
                <span>子系统控制</span>
              </template>
              <el-submenu index="2-1">
                <template slot="title">
                  <span>系统配置</span>
                </template>
                <el-menu-item @click="toPage('/HomeView/SystemConfiguration')">爬虫任务参数配置</el-menu-item>
                <el-menu-item @click="toPage('/HomeView/DevConfiguration')">系统物理设备配置</el-menu-item>
              </el-submenu>
              <el-menu-item @click="toPage('/HomeView/MonitorLog')">监控日志</el-menu-item>
            </el-submenu>
            <!-- <el-submenu index="4">
              <template slot="title">
                <i class="el-icon-data-analysis"></i>
                <span>结果导出</span>
              </template>
              <el-menu-item index="/HomeView/ResultExport/CollectTask">采集任务</el-menu-item>
              <el-menu-item index="/HomeView/ResultExport/RetrievalTask">检索任务</el-menu-item>
            </el-submenu> -->
            <el-submenu index="5">
              <template slot="title">
                <i class="el-icon-user"></i>
                <span>用户管理</span>
              </template>
              <el-menu-item @click="toPage('/HomeView/RoleEdit')">角色编辑</el-menu-item>
              <el-menu-item @click="toPage('/HomeView/UserEdit')">用户编辑</el-menu-item>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-container>
          <el-main>

            <RouterView />
          </el-main>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>

<script>


export default {
  methods: {
    open() {
      this.$confirm('是否退出登录', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$router.push("/Login");
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        });
      });
    },
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    toPage(url) {
      this.$router.push({
        path: url
      })
    },

  }
}
</script>

<style>
body {
  margin: 0;
  padding: 0;
}
</style>
